/* 登录弹窗样式 - 确保所有触发方式下都能正确居中 */
.login-modal-overlay {
    position: fixed !important; /* 强制使用固定定位 */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    display: flex !important; /* 强制使用flex布局 */
    align-items: center !important; /* 垂直居中 */
    justify-content: center !important; /* 水平居中 */
    z-index: 9999 !important; /* 最高层级，确保覆盖所有内容 */
    padding: 1rem;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    box-sizing: border-box !important; /* 确保padding不影响定位 */
    overflow: auto; /* 允许在小屏幕上滚动 */
    transform: none !important; /* 防止父元素transform影响定位 */
}

.login-modal {
    background: var(--dark);
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    animation: slideUp 0.3s forwards;
    max-height: 90vh; /* 限制最大高度 */
    overflow-y: auto; /* 内容过长时允许滚动 */
    margin: 0 !important; /* 移除默认margin */
    box-sizing: border-box;
    position: relative !important; /* 确保相对定位 */
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal-btn:hover {
    color: var(--light);
}

.login-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.form-control {
    width: 100%;
    padding: 0.875rem;
    background: var(--darker);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--light);
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
}

.forgot-password {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #4080ff;
}

.login-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: #4080ff;
    transform: translateY(-2px);
}

.register-redirect {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}

.register-redirect a {
    color: var(--primary);
    text-decoration: none;
}

/* 动画效果 */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    to {
        transform: translateY(0);
    }
}

/* 登录标签切换样式 */
.login-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.login-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.login-tab.active {
    color: var(--primary);
}

.login-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
}

.login-tab:hover:not(.active) {
    color: var(--light);
}

/* 验证码输入区域样式 */
.form-code-group .code-input-container {
    display: flex;
    gap: 0.5rem;
}

.code-input {
    flex: 1;
}

.get-code-btn {
    padding: 0 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.get-code-btn:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    cursor: not-allowed;
}

.get-code-btn:not(:disabled):hover {
    background-color: rgba(22, 93, 255, 0.2);
}

/* 其他登录方式样式 */
.other-login-methods {
    padding: 0 1.5rem;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    width: 100%;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
}

.login-divider span {
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--muted);
    white-space: nowrap;
}

.social-login-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0 1.5rem;
}

.social-login-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.social-login-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.social-login-btn.wechat {
    background-color: #07C160;
}

.social-login-btn.qq {
    background-color: #12B7F5;
}

.serve-item {
    margin: 1rem 0 1.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.serve-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.serve-item .remember-me {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.serve-item input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 16px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.serve-item input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.serve-item input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.serve-item input[type="checkbox"]:hover:not(:checked) {
    border-color: var(--primary);
}

.serve-item a {
    color: var(--primary);
    text-decoration: none;
    position: relative;
    padding: 0 2px;
}

.serve-item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.serve-item a:hover {
    color: #4080ff;
}

.serve-item a:hover::after {
    width: 100%;
}

@media (max-width: 480px) {
    .serve-item .remember-me {
        flex-direction: column;
        align-items: flex-start;
    }

    .serve-item input[type="checkbox"] {
        margin-top: 0;
    }
}

.login-btn:disabled {
    background-color: rgba(22, 93, 255, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-btn:disabled {
    color: rgba(255, 255, 255, 0.7);
}
